SFTP only + Chroot
2015/11/28 |
Configure SFTP only + Chroot.
Some users who are applied this settings can access only with SFTP and access to the permitted directories. |
|
[1] | For example, Set /home as the Chroot directory. |
dlp:~ #
vi /etc/ssh/sshd_config # line 135: comment out and add a line like below # Subsystem sftp /usr/lib64/ssh/sftp-serverSubsystem sftp internal-sftp
# add follows to the end
Match Group sftp_users
X11Forwarding no AllowTcpForwarding no ChrootDirectory /home ForceCommand internal-sftp /etc/init.d/sshd restart |
[2] | Try to access with a user to verify settings. |
suse@rx7:~>
suse@rx7:~> ssh suse@10.0.0.30 password: This service allows sftp connections only. Connection to 10.0.0.30 closed. # denied normally
sftp suse@10.0.0.30 Connecting to 10.0.0.30... password: sftp> ls -l drwxr-xr-x 7 suse 100 169 Nov 21 22:35 suse drwxr-xr-x 7 cent 100 169 Nov 21 22:35 centsftp> pwd Remote working directory: / sftp> exit |